# -*- coding: UTF-8 -*-

SPD = 1000
critPr = 21.0
haste = 1 / 25.

ArcaneSchool = 1
FireSchool = 2
FrostSchool = 3


class TTalents:
    # fire Talents
    ImpruvedFB = 0 # 0-5
    Burnout = 0 #0-5
    Ignite = 0 #0-5
    PlayWithFire = 0 #0-3 все спелы?!
    CriticalMass = 0 # 0-3
    FirePower = 0 # 0-5
    PyroManiac = 0 #0-3
    EmpoweredFireball = 0 #0-5


    def ini(self,spell):
        if (spell.Name == 'FireBall'):
            spell.decreaseCastTime += (0.1*self.ImpruvedFB)
        if FireSchool in spell.School:
            spell.CritDmgKoef += (.05*self.Burnout)
        if FireSchool in spell.School:
            spell.CritDmgKoef += 0.125* self.Ignite * FireBall.CritDmgKoef
        spell.DmgPrInc += 1*self.PlayWithFire
        if FireSchool in spell.School:
            spell.critPr += self.CriticalMass*2
        if spell.Name in ('FireBall','FireFrostBolt'):
            spell.SPD *= 1+(0.03*self.EmpoweredFireball)
        if FireSchool in spell.School:
            FireBall.DmgPrInc += self.FirePower*2
        if FireSchool in spell.School:
            spell.critPr += 1*self.PyroManiac

class FireTest(TTalents):
    ImpruvedFB = 5 # 0-5
    Burnout = 5 #0-5
    Ignite = 5 #0-5
    PlayWithFire = 3 # все спелы?!
    CriticalMass = 3
    FirePower = 5 # fireball firefrostbolt
    PyroManiac = 3
    EmpoweredFireball = 5

class TSpell:
    """A spell class"""
    Name = "NoName"
    School = () #fire frost arcan

    Talents = TTalents()
    dmgBase = 1
    castTimeBase = 1.5
    hastePr = 0
    decreaseCastTime = 0
    Spd2DmgBase = 0. # spd2dmg коффициент базовый для спела
    CritDmgKoef = 1.5 # крит коефициент
    DmgPrInc = 0. # увеличитель итоговый %
    critPr = critPr
    SPD = SPD
    
    def dmg(self):
        """Дамаг спела"""
        return (self.dmgBase + self.spd2dmg()) * (1 + self.DmgPrInc / 100)

    def critDmg(self):
        """Крит дамаг"""
        return  (self.dmg() * self.CritDmgKoef)

    def castTime(self):
        """Время каста"""
        return (self.castTimeBase - self.decreaseCastTime) * (1-haste)

    def spd2dmg(self):
        "преобразование спд в дамаг;"
        return self.Spd2DmgBase * self.SPD

    def dps(self):
        return ((100.-critPr) * self.dmg() + self.critDmg() * critPr) / 100. / self.castTime()
		#((((100.-critPr)*self.dmg()
		#+self.CritDmg()*critPr)/100.)/self.castTime())
    def ini(self):
        self.Talents.ini(self)

class TFireBall(TSpell):
    Name = 'FireBall'
    School = (FireSchool,)
    dmgBase = (717 + 913) / 2
    castTimeBase = 3.5
    Spd2DmgBase = 1




#FireBall = TFireBall()
##FireBall.Talents = FireTest()
#FireBall.ini()
#
##imp scorch
#critPr += 10
#
##MolteFury
#FireBall.DmgPrInc += (35. / 100.) * 12.



FireBall = TFireBall()
FireBall.Talents = FireTest()
FireBall.ini()

print "dmg:", FireBall.dmg()
print "Crit dmg:", FireBall.critDmg()
print "DPS:", FireBall.dps()

FireBall = TFireBall()
FireBall.ini()
print "dmg:", FireBall.dmg()
print "Crit dmg:", FireBall.critDmg()
print "DPS:", FireBall.dps()
